sessionStorage.removeItem("menu");
sessionStorage.removeItem("curMenu");
var temp1;

			layui.use(['form', 'layedit', 'laydate', 'element'], function() {
				var form = layui.form,
					layer = layui.layer,
					layedit = layui.layedit,
					element = layui.element,
					laydate = layui.laydate;

				//日期
				laydate.render({
					elem: '#date'
				});
				laydate.render({
					elem: '#date1'
				});

				//创建一个编辑器
				var editIndex = layedit.build('LAY_demo_editor');

				//自定义验证规则
				form.verify({
					title: function(value) {
						if(value.length < 5) {
							return '标题至少得5个字符啊';
						}
					},
					pass: [/(.+){6,12}$/, '密码必须6到12位'],
					content: function(value) {
						layedit.sync(editIndex);
					}
				});

				

				//						教员登录
				form.on('submit(teacherLogin)', function(data) {
					$('#teacherLogin').attr('disabled','disabled')
					$('#teacherLogin').val('正在登录中...')

					var param1 = data.field;
					var stamp = new Date().getTime();
					var param = Object.assign(param1, publicParam, {
						stamp: stamp
					});
					param = JSON.stringify(param);

//					return teacherLogin(param);
				var abc = teacherLogin(param)
					if(abc){
						$('#teacherLogin').removeAttr('disabled')
						$('#teacherLogin').val('登录')
						window.location.href = "personInfo.html";
						return true;
					}else{
						$('#teacherLogin').removeAttr('disabled')
						$('#teacherLogin').val('登录')
						return false;
					}				
				});

				//				教员登录函数
				function teacherLogin(param) {
					var url = path + "/teacher/login";
					var teacherToken
					var flag = false;
					$.ajax({
						type: "post",
						url: url,
						dataType: "json",
						async: false,
						data: {param: param},
						success: function(data) {
							status = data.status;
							if(status == "000") {
								teacherToken = data.systoken;
								teacher = data.rows;
								var systoken = data.systoken;
								var name = teacher.name;
								var account = teacher.account;
								var age = teacher.age;
								var rank = teacher.rank;
								var birthday = teacher.birthday;
								var idCard = teacher.idCard;
								var school = teacher.school;
								var qrCode = teacher.qrCode;
								var gender = teacher.gender;
								var liaison = teacher.liaison;
								var category = category;
								var educationHighest = educationHighest;
								var id = teacher.id;
								
								sessionStorage.setItem("systoken", systoken);
								sessionStorage.setItem("category", category);
								sessionStorage.setItem("name", name);
								sessionStorage.setItem("age", age);
								sessionStorage.setItem("account", account);
								sessionStorage.setItem("rank", rank);
								sessionStorage.setItem("birthday", birthday);
								sessionStorage.setItem("idCard", idCard);
								sessionStorage.setItem("school", school);
								sessionStorage.setItem("qrCode", qrCode);
								sessionStorage.setItem("gender", gender);
								sessionStorage.setItem("liaison", liaison);
								sessionStorage.setItem("educationHighest", educationHighest);
								sessionStorage.setItem("id", id);

								flag=true;
							} else if (status == '001') {
								layer.msg('用户名或密码错误');
								flage = false;
							} else if (status == '005') {
								layer.msg('后台处理异常');
								flage = false;
							} else if (status == '006') {
								layer.msg(data.rows);
								flage = false;
							}
						},
						error: function(data) {
							alert('登录异常!')
							flag = false;
						}
					})
					return flag;
				}
				//	-- -- -- -- -- -- -- -- -- -- -
				//						学员登录
				form.on('submit(studentLogin)', function(data) {
					$('#studentLogin').attr('disabled','disabled')
					$('#studentLogin').val('正在登录中...')

					var param1 = data.field;
					var stamp = new Date().getTime();
					var param = Object.assign(param1, publicParam, {
						stamp: stamp
					});
					param = JSON.stringify(param);
					
					if(studentLoginUp(param)){
						$('#studentLogin').removeAttr('disabled')
						$('#studentLogin').val('登录')
						window.location.href = "personInfo1.html";
						return true;
					}else{
						$('#studentLogin').removeAttr('disabled')
						$('#studentLogin').val('登录')
						return false;
					}
				});

				//---------------------------------------
				//学员登录函数
				function studentLoginUp(param) {
					var url = path + "/student/login";
					var flag = false;
					$.ajax({
						type: "post",
						url: url,
						dataType: "json",
						async: false,
						data: {param: param},
						success: function(data) {
							var status = data.status;
							if(status == "000") {
								var student = data.student;
								sessionStorage.setItem("account", student.account);								
								sessionStorage.setItem("id", student.id);
								sessionStorage.setItem("systoken", data.systoken);
								sessionStorage.setItem("name", student.name);								
//								window.location.href = "index1.html";								
//								var student = data.student;
//								var name = student.name;
//								var account = student.account;
//								var age = student.age;
//								var rank = student.rank;
//								var birthday = student.birthday;
//								var idCard = student.idCard;
//								var school = student.school;
//								var qrCode = student.qrCode;
//								var gender = student.gender;
//								var liaison = student.liaison;
//								var category = category;
//								var educationHighest = educationHighest;
//								var id = student.id;
//								var address=student.address;
//								var email=student.email;
//								var englishLevel=student.englishLevel;
//								var nation=student.nation;
//								var seat=student.seat;
//								var height=student.height;
//								var weight=student.weight;
//								var job=student.job;														
								flag = true;
							}else if(status == '001') {
								layer.msg('用户名或密码错误');
								flage = false;
							} else if (status == '005') {
								layer.msg('后台处理异常');
								flage = false;
							} else if (status == '006') {
								layer.msg(data.rows);
								flage = false;
							}
						},
						error: function(data) {
							flag = false;
							setTips('登录异常!')
						}
					})
					return flag;
				}
				//-----------------------------
				//获取学员菜单
				function queryStudentMenu(param, systoken) {
					var flag = false;
					var url = path + "/student/queryMenu"
					var systoken = sessionStorage.getItem('systoken');
					$.ajax({
						url: url,
						type: "post",
						data: {param: param},
						headers: {Authorization: systoken},
						dataType: "json",
						success: function(res) {
							var allMenus = res.rows;
							allMenus = JSON.stringify(allMenus);
							sessionStorage.setItem('totalMenus', allMenus);
							window.location.href="studentIndex.html";
						},
						error: function() {
							sessionStorage.clear();
							alert("网络异常!");
						}
					})
					return flag;
				}
			});
			
//封装模态框
function jumpModule(value){
	layui.use(['layer'],function(){
		var layer=layui.layer;
		layer.msg(value)
	})
}

sessionStorage.removeItem("menu");
sessionStorage.removeItem("curMenu");